struct CreateCommentRequest{
    1: string entity_type (api.body="entity_type"); // 评论所针对的实体类型, 枚举值 "moment": 动态; "comment": 评论.
    2: i64 entity_id (api.body="entity_id");        // 评论所针对的实体id
    3: CommentContent content (api.body="content"); // 评论内容
}

struct CommentContent{
    1: string text; // 文本内容
}

struct CreateCommentResponse{
    1: Meta meta;
    2: Comment comment; // 成功发表的评论
}

struct Comment{
    1: i64 comment_id;          // 评论id
    2: string entity_type;      // 评论所针对的实体类型
    3: i64 entity_id;           // 评论所针对的实体id
    4: CommentContent content;  // 评论的内容
    5: i64 like_count;          // 点赞数量
    6: i64 comment_count;       // 评论数量
    7: i64 user_id;             // 发表者的用户id
    8: string nickname;         // 发表者的昵称
    9: string head_url;         // 发表者的头像
    10: string create_at;       // 评论发表的时间, 形如"2006-01-02", "刚刚"
    11: bool i_like_it;         // 当前登陆用户是否点赞
}

struct DeleteCommentRequest{
    1: i64 comment_id (api.path="comment_id")
}

struct DeleteCommentResponse{
    1: Meta meta;
}

struct GetCommentsRequest{
    1: i64 limit (api.query="limit");
    2: i64 offset (api.query="offset");
    3: i64 entity_type (api.query="entity_type");
    4: i64 entity_id (api.query="entity_id");
}

struct GetCommentsResponse{
    1: Meta meta;
    2: list<Comment> comments;
    3: i32 total;
}

struct ThumbUpRequest{
    1: string entity_type (api.body="entity_type"); // 点赞的实体类型
    2: i64 entity_id (api.body="entity_id");      // 点赞的实体id
}

struct ThumbUpResponse{
    1: Meta meta;
}

struct CancelThumbUpRequest{
    1: string entity_type (api.body="entity_type"); // 取消点赞的实体类型
    2: i64 entity_id (api.body="entity_id");      // 取消点赞的实体id
}

struct CancelThumbUpResponse{
    1: Meta meta;
}

struct Meta{
    1: i32 code;    // 业务自定义的返回值, 0为成功, 其他情况为失败
    2: string msg;
}

service CommentService{
    // 评论
    CreateCommentResponse CreateComment(1: CreateCommentRequest req) (api.post="/nearby/comment")
    GetCommentsResponse GetComments(1: GetCommentsRequest req) (api.get="/nearby/comments")
    DeleteCommentResponse DeleteComment(1: DeleteCommentRequest req) (api.delete="/nearby/comment")

    // 点赞
    ThumbUpResponse ThumbUp(1: ThumbUpRequest req) (api.post="/nearby/thumb_up")
    // 取消点赞
    CancelThumbUpResponse CancelThumbUp(1: CancelThumbUpRequest req) (api.post="/nearby/cancel_thumb_up")
}